//
// Copyright (C) 2011 - 2013  Steve Channell steve.channell@cepheis.com
//
// This file is part of Cephei.QL, an open-source library wrapper 
// arround QuantLib http://quantlib.org/
//
// Cephei.QL is open source software: you can redistribute it and/or modify it
// under the terms of the license.  You should have received a
// copy of the license along with this program; if not, please email
// <support@cepheis.com>. The license is also available online at
// <http://cepheis.com/license.htm>.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE.  See the license for more details.
//
// Version 2.2 with QuantLib 1.2.1
//#include "stdafx.h"
#include "MixedLinearKrugerCubic.h"
using namespace Cephei::QL::Math::Interpolations;
#include <gen/QL/Math/Interpolations/MixedLinearCubicInterpolation.h>
#undef HANDLE
#undef ABSTRACT
#undef STRUCT
Cephei::QL::Math::Interpolations::CMixedLinearKrugerCubic::CMixedLinearKrugerCubic (boost::shared_ptr<QuantLib::MixedLinearKrugerCubic>& childNative, Object^ owner) : CMixedLinearCubicInterpolation(CMixedLinearKrugerCubic::typeid)
{
#ifdef HANDLE
	_phMixedLinearKrugerCubic = NULL;
#endif
	_ppMixedLinearKrugerCubic = &childNative;
    _ppMixedLinearCubicInterpolation = new boost::shared_ptr<QuantLib::MixedLinearCubicInterpolation> (boost::dynamic_pointer_cast<QuantLib::MixedLinearCubicInterpolation> (*_ppMixedLinearKrugerCubic));
}
Cephei::QL::Math::Interpolations::CMixedLinearKrugerCubic::CMixedLinearKrugerCubic (QuantLib::MixedLinearKrugerCubic& childNative, Object^ owner) : CMixedLinearCubicInterpolation(CMixedLinearKrugerCubic::typeid)
{
#ifdef HANDLE
	_phMixedLinearKrugerCubic = NULL;
#endif
	_ppMixedLinearKrugerCubic = new boost::shared_ptr<QuantLib::MixedLinearKrugerCubic> (&childNative);
    _ppMixedLinearCubicInterpolation = new boost::shared_ptr<QuantLib::MixedLinearCubicInterpolation> (boost::dynamic_pointer_cast<QuantLib::MixedLinearCubicInterpolation> (*_ppMixedLinearKrugerCubic));
    _MixedLinearKrugerCubicOwner = owner;
    _MixedLinearCubicInterpolationOwner = owner;
}

Cephei::QL::Math::Interpolations::CMixedLinearKrugerCubic::CMixedLinearKrugerCubic (CMixedLinearKrugerCubic^ copy) : CMixedLinearCubicInterpolation(CMixedLinearKrugerCubic::typeid)
{
#ifdef HANDLE
	_phMixedLinearKrugerCubic = NULL;
#endif
	if (copy->HasNative() != NULL)
    {
		_ppMixedLinearKrugerCubic = new boost::shared_ptr<QuantLib::MixedLinearKrugerCubic> (copy->GetShared());
        _ppMixedLinearCubicInterpolation = new boost::shared_ptr<QuantLib::MixedLinearCubicInterpolation> (boost::dynamic_pointer_cast<QuantLib::MixedLinearCubicInterpolation> (*_ppMixedLinearKrugerCubic));
    }
}
Cephei::QL::Math::Interpolations::CMixedLinearKrugerCubic::CMixedLinearKrugerCubic (PLATFORM::Type^ t) : CMixedLinearCubicInterpolation(CMixedLinearKrugerCubic::typeid)
{
#ifdef HANDLE
	_phMixedLinearKrugerCubic = NULL;
#endif
	if (!t->IsSubclassOf(CMixedLinearKrugerCubic::typeid))
		throw REFNEW Exception ("Invalid base-case init");
}
#ifdef HANDLE
Cephei::QL::Math::Interpolations::CMixedLinearKrugerCubic::CMixedLinearKrugerCubic (QuantLib::Handle<QuantLib::MixedLinearKrugerCubic>& childNative, Object^ owner)  : CMixedLinearCubicInterpolation(CMixedLinearKrugerCubic::typeid)
{
	_phMixedLinearKrugerCubic = &childNative;
	_ppMixedLinearKrugerCubic = &static_cast<boost::shared_ptr<QuantLib::MixedLinearKrugerCubic>>(childNative.currentLink());
    _ppMixedLinearCubicInterpolation = new boost::shared_ptr<QuantLib::MixedLinearCubicInterpolation> (boost::dynamic_pointer_cast<QuantLib::MixedLinearCubicInterpolation> (*_ppMixedLinearKrugerCubic));
    _MixedLinearKrugerCubicOwner = owner;
}
Cephei::QL::Math::Interpolations::CMixedLinearKrugerCubic::CMixedLinearKrugerCubic (QuantLib::Handle<QuantLib::MixedLinearKrugerCubic> childNative)  : CMixedLinearCubicInterpolation(CMixedLinearKrugerCubic::typeid)
{
	_phMixedLinearKrugerCubic = &childNative;
	_ppMixedLinearKrugerCubic = &static_cast<boost::shared_ptr<QuantLib::MixedLinearKrugerCubic>>(childNative.currentLink());
    _ppMixedLinearCubicInterpolation = new boost::shared_ptr<QuantLib::MixedLinearCubicInterpolation> (boost::dynamic_pointer_cast<QuantLib::MixedLinearCubicInterpolation> (*_ppMixedLinearKrugerCubic));
}
#endif
#ifdef STRUCT
Cephei::QL::Math::Interpolations::CMixedLinearKrugerCubic::CMixedLinearKrugerCubic (QuantLib::MixedLinearKrugerCubic childNative)  : CMixedLinearCubicInterpolation(CMixedLinearKrugerCubic::typeid)
{
#ifdef HANDLE
	_phMixedLinearKrugerCubic = NULL;
#endif
	_ppMixedLinearKrugerCubic = new boost::shared_ptr<QuantLib::MixedLinearKrugerCubic> (new QuantLib::MixedLinearKrugerCubic (childNative));
    _ppMixedLinearCubicInterpolation = new boost::shared_ptr<QuantLib::MixedLinearCubicInterpolation> (boost::dynamic_pointer_cast<QuantLib::MixedLinearCubicInterpolation> (*_ppMixedLinearKrugerCubic));
}
#endif

Cephei::QL::Math::Interpolations::CMixedLinearKrugerCubic::~CMixedLinearKrugerCubic ()
{
    if (_ppMixedLinearKrugerCubic != NULL)
    {
	    delete _ppMixedLinearKrugerCubic;
        _ppMixedLinearKrugerCubic = NULL;
    }
}
Cephei::QL::Math::Interpolations::CMixedLinearKrugerCubic::!CMixedLinearKrugerCubic ()
{
    if (_ppMixedLinearKrugerCubic != NULL)
    {
	    delete _ppMixedLinearKrugerCubic;
    }
}
QuantLib::MixedLinearKrugerCubic& Cephei::QL::Math::Interpolations::CMixedLinearKrugerCubic::GetReference ()
{
    if (_ppMixedLinearKrugerCubic == NULL) throw REFNEW NativeNullException ();
	return **_ppMixedLinearKrugerCubic;
}
boost::shared_ptr<QuantLib::MixedLinearKrugerCubic>& Cephei::QL::Math::Interpolations::CMixedLinearKrugerCubic::GetShared ()
{
    if (_ppMixedLinearKrugerCubic == NULL) throw REFNEW NativeNullException ();
	return *_ppMixedLinearKrugerCubic;
}
QuantLib::MixedLinearKrugerCubic* Cephei::QL::Math::Interpolations::CMixedLinearKrugerCubic::GetPointer ()
{
    if (_ppMixedLinearKrugerCubic == NULL) throw REFNEW NativeNullException ();
	return &**_ppMixedLinearKrugerCubic;
}
#ifdef HANDLE
QuantLib::Handle<QuantLib::MixedLinearKrugerCubic>& Cephei::QL::Math::Interpolations::CMixedLinearKrugerCubic::GetHandle ()
{
	if (_phMixedLinearKrugerCubic == NULL)
	{
		_phMixedLinearKrugerCubic = new Handle<QuantLib::MixedLinearKrugerCubic> (*_ppMixedLinearKrugerCubic);
	}
	return *_phMixedLinearKrugerCubic;
}
#endif
bool Cephei::QL::Math::Interpolations::CMixedLinearKrugerCubic::HasNative () 
{
	return (_ppMixedLinearKrugerCubic != NULL);
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Factory class

